<?

include_once "../conn.php";

if($_POST[credit_card_processed] == 'Y')
{
	$array = explode("|", $_POST[cart_order_id]);

	$PlanName = $array[0];
	$payename = $array[2];
	$user_type = $array[3];

	$q = "select * from job_plan where PlanName = '$PlanName' ";
	$r = mysql_query($q) or die(mysql_error());
	$a = mysql_fetch_array($r);

	$q1 = "update job_employer_info set plan = '$PlanName', JS_number = '$a[reviews]', JP_number = '$a[postings]' where ename = '$payename' ";
	mysql_query($q1) or die(mysql_error());

	$qm = "select CompanyEmail from job_employer_info where ename = '$payename' ";
	$rqm = mysql_query($qm) or die(mysql_error());
	$am = mysql_fetch_array($rqm);

	$to = $am[0];
	$subject = "Your employer plan at $_SERVER[HTTP_HOST]";
	$message = "Hello,\nhere is your employer plan information at $_SERVER[HTTP_HOST]:\n\nPlan name: $PlanName\nNumber of resume viewing: $a[reviews]\nNumber of Job Offer postings: $a[postings]\n\n$_SERVER[HTTP_HOST]";
	$from = "From: $_SERVER[HTTP_HOST] <$aset[ContactEmail]>";

	mail($to, $subject, $message, $from);

}

header("location:../index.php");

?>